package name.fowler.refactoring;

import static org.mockito.Mockito.*;
import name.fowler.refactoring.simplestore.PriceCodes;
import name.fowler.refactoring.simplestore.Rental;

public class RentalBuilder {
	
	private PriceCodes priceCodes = PriceCodes.Childrens;
	private int daysRented = 1;

	public RentalBuilder withPriceCode(PriceCodes priceCodes) {
		this.priceCodes = priceCodes;
		return this;
	}
	
	public RentalBuilder withDaysRented(int daysRented) {
		this.daysRented = daysRented;
		return this;
	}

	public Rental build() {
		Rental rentalStub = mock(Rental.class);
		when(rentalStub.getMovieTitle()).thenReturn("dummy-movie-title");
		when(rentalStub.getMoviePriceCode()).thenReturn(priceCodes);
		when(rentalStub.getDaysRented()).thenReturn(daysRented);
		return rentalStub;
	}
}
